/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainWindowView.java
 *
 * Created on 2011-05-23, 08:32:31
 */
package ytmc.mainWindow;

import javax.swing.ImageIcon;
import ytmc.*;

/**
 *
 * @author Kicok
 */
public class MainWindowView extends FrameView
{
    private MainWindowController controller;


    /** Creates new form MainWindowView */
    public MainWindowView( MainWindowController controller )
    {
        this.controller = controller;

        initComponents();
        setLocationRelativeTo( null );
    }

    public void addChild( String title, PanelView view )
    {
        addChild( view );
        tabbedPane.addTab( title, view );
    }

    public void addChild( String title, String icon, PanelView view )
    {
        addChild( view );
        
        ImageIcon image;
        if(icon.startsWith("/"))
        {
            image = new ImageIcon(getClass().getResource(icon));
        }
         else
        {
            image = new ImageIcon(icon);
        }

        tabbedPane.addTab( title, image, view );
    }

    public void setActiveTab( int i )
    {
        tabbedPane.setSelectedIndex( i );
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings( "unchecked" )
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabbedPane = new javax.swing.JTabbedPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("YouTube Management Center");
        setMinimumSize(new java.awt.Dimension(720, 520));

        tabbedPane.setMinimumSize(new java.awt.Dimension(600, 480));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 639, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane tabbedPane;
    // End of variables declaration//GEN-END:variables
}